package datasv.teacherQuery_datasv;

import data.datafactory.DatabaseOperator;
import resultmessage.TeacherQueryRM;

public class DeleteTeacher {
	public static void main(String[] args) {
		System.out.println(new DeleteTeacher().deleteTeacher("001132014"));
	}
	public TeacherQueryRM deleteTeacher(String id){
		return deleteInSql(id);
	}
	private TeacherQueryRM deleteInSql(String id){
		DatabaseOperator op=new DatabaseOperator("college"+id.substring(0,3));
		if(!op.ifDatabaseExist()||!op.ifIDExist("teacher_list", id)){
			return TeacherQueryRM.TEACHERID_NOT_EXIST;
		}
		if(op.deleteOneRow(id, "teacher_list")){
			return TeacherQueryRM.SUCCESS;
		}
		return TeacherQueryRM.TEACHERID_NOT_EXIST;
	}
	
}
